home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17668 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  38 lines

  1. Path: holly.ACNS.ColoState.EDU!not-for-mail
  2. From: corbyh@holly.ACNS.ColoState.EDU (Corby S. Hudnall)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: one character input?
  5. Date: 16 Apr 1996 19:04:29 -0600
  6. Organization: Colorado State University, Fort Collins, CO  80523
  7. Message-ID: <4l1g2t$1aoo@holly.ACNS.ColoState.EDU>
  8. References: <3173AAF0.3515@struct.kth.se>
  9. NNTP-Posting-Host: holly.acns.colostate.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Peter Andren wrote:
  13. : Hello,
  14.  
  15. : I need a function to read one character from the keyboard without to end
  16. : the input with a returncharacter. Unfortunatly I'm not able to find this
  17. : funtion in my book, but I have a strong feeling that it shouldn't be so
  18. : difficult.
  19.  
  20. Not sure exactly what you want but have you tried the get function.  Use 
  21. it like so:
  22.   char temp;
  23.   cin.get(temp);
  24. This will get one character at a time and place it into temp.  Easy right?
  25.  
  26. // ------------ BEGIN SIGNATURE ---------------
  27. #include <iostream.h>
  28. void main(void)
  29. {
  30.   cout << "\aName:\tCorby S. Hudnall\n"
  31.        << "School:\tColorado State University\n"
  32.        << "\tDepartement of Computer Science\n"
  33.        << "EMail:\thudnall@CS.ColoState.EDU\n"
  34.        << "URL:\thttp://WWW.CS.ColoState.EDU/~hudnall\n";
  35. }
  36. // ------------ END SIGNATURE -----------------
  37.  
  38.